import BasicLayout from "../layouts/BasicLayout/BasicLayout.vue";
import NoAuthView from "../views/CommonViews/NoAuthView.vue";
import LoginView from "../views/CommonViews/LoginView.vue";
import USER_ROLE_ENUM from "../access/userRoleEnum.ts";
//import TestView from "../views/CommonViews/TestView.vue";
import UserBackgroundView from "../views/UserBackgroundViews/UserBackgroundView.vue";
import AdminLayout from "../views/adminLayout/index.vue";


export const routes = [
  {
    path: "/",
    component: BasicLayout,
    redirect: "home",
    children: [
      {
        path: "home",
        name: "home",
        component: () => import("@/views/CommonViews/HomeView/HomeView.vue"),
        meta: {
          title: "首页",
        },
      },
      {
        path: "club/list",
        name: "club-list",
        component: () =>
          import("@/views/CommonViews/ClubViews/ClubListView.vue"),
        meta: {
          title: "社团列表",
        },
      },
      {
        path: "club",
        name: "club-view",
        redirect: "club/details",
        component: () => import("@/views/CommonViews/ClubViews/ClubView.vue"),
        meta: {
          title: "社团页",
        },
        children: [
          {
            path: "details",
            name: "club-details",
            component: () =>
              import("@/views/CommonViews/ClubViews/components/details.vue"),
            meta: {
              title: "社团详情",
              needRoles: [
                USER_ROLE_ENUM.USER,
                USER_ROLE_ENUM.MANAGER,
                USER_ROLE_ENUM.ADMIN,
              ],
            },
          },
          {
            path: "members",
            name: "club-members",
            component: () =>
              import("@/views/CommonViews/ClubViews/components/memberList.vue"),
            meta: {
              title: "社团成员",
              needRoles: [
                USER_ROLE_ENUM.USER,
                USER_ROLE_ENUM.MANAGER,
                USER_ROLE_ENUM.ADMIN,
              ],
            },
          },
          {
            path: "announcements",
            name: "club-announcements",
            component: () =>
              import(
                "@/views/CommonViews/ClubViews/components/announcementList.vue"
              ),
            meta: {
              title: "社团公告",
              needRoles: [
                USER_ROLE_ENUM.USER,
                USER_ROLE_ENUM.MANAGER,
                USER_ROLE_ENUM.ADMIN,
              ],
            },
          },
          {
            path: "announcement/info",
            name: "announcement",
            component: () =>
              import(
                "@/views/CommonViews/ClubViews/components/announcementDetail.vue"
              ),
            meta: {
              title: "公告详情",
              needRoles: [
                USER_ROLE_ENUM.USER,
                USER_ROLE_ENUM.MANAGER,
                USER_ROLE_ENUM.ADMIN,
              ],
            },
          },
          {
            path: "activities",
            name: "club-activities",
            component: () =>
              import(
                "@/views/CommonViews/ClubViews/components/activityList.vue"
              ),
            meta: {
              title: "社团公告",
              needRoles: [
                USER_ROLE_ENUM.USER,
                USER_ROLE_ENUM.MANAGER,
                USER_ROLE_ENUM.ADMIN,
              ],
            },
          },
        ],
      },
      {
        path: "activity/list",
        name: "activity-list",
        component: () =>
          import("@/views/CommonViews/ActivityViews/ActivityListView.vue"),
        meta: {
          title: "活动列表",
        },
      },
      {
        path: "activity",
        name: "activity-view",
        redirect: "activity/details",
        component: () =>
          import("@/views/CommonViews/ActivityViews/ActivityView.vue"),
        meta: {
          title: "活动页",
        },
        children: [
          {
            path: "details",
            name: "activity-details",
            component: () =>
              import(
                "@/views/CommonViews/ActivityViews/components/details.vue"
              ),
            meta: {
              title: "活动详情",
              needRoles: [
                USER_ROLE_ENUM.USER,
                USER_ROLE_ENUM.MANAGER,
                USER_ROLE_ENUM.ADMIN,
              ],
            },
          },
          {
            path: "members",
            name: "activity-members",
            component: () =>
              import(
                "@/views/CommonViews/ActivityViews/components/memberList.vue"
              ),
            meta: {
              title: "活动成员",
              needRoles: [
                USER_ROLE_ENUM.USER,
                USER_ROLE_ENUM.MANAGER,
                USER_ROLE_ENUM.ADMIN,
              ],
            },
          },
        ],
      },
      {
        path: "application/add",
        component: () =>
          import(
            "@/views/CommonViews/AddApplicationViews/template/AddApplicationViewTemplate.vue"
          ),
        redirect: "application/add/delete-user",
        children: [
          {
            path: "delete-user",
            name: "add-delete-user-application",
            component: () =>
              import(
                "@/views/CommonViews/AddApplicationViews/AddDeleteUserApplicationView.vue"
              ),
            meta: {
              type: 0,
            },
          },
          {
            path: "join-club",
            name: "add-join-club-application",
            component: () =>
              import(
                "@/views/CommonViews/AddApplicationViews/AddJoinOrQuitClubApplicationView.vue"
              ),
            meta: {
              type: 1,
            },
          },
          {
            path: "quit-club",
            name: "add-quit-club-application",
            component: () =>
              import(
                "@/views/CommonViews/AddApplicationViews/AddJoinOrQuitClubApplicationView.vue"
              ),
            meta: {
              type: 2,
            },
          },
          {
            path: "join-activity",
            name: "add-join-activity-application",
            component: () =>
              import(
                "@/views/CommonViews/AddApplicationViews/AddJoinOrQuitActivityApplicationView.vue"
              ),
            meta: {
              type: 3,
            },
          },
          {
            path: "quit-activity",
            name: "add-quit-activity-application",
            component: () =>
              import(
                "@/views/CommonViews/AddApplicationViews/AddJoinOrQuitActivityApplicationView.vue"
              ),
            meta: {
              type: 4,
            },
          },
          {
            path: "create-club",
            name: "add-create-club-application",
            component: () =>
              import(
                "@/views/ManagerBackStageViews/InfoManageViews/AddCreateOrUpdateClubApplicationView.vue"
              ),
            meta: {
              type: 5,
            },
          },
          {
            path: "delete-club",
            name: "add-create-club-application",
            component: () =>
              import(
                "@/views/ManagerBackStageViews/InfoManageViews/AddDeleteClubApplicationView.vue"
              ),
            meta: {
              type: 6,
            },
          },
        ],
      },
    ],
  },
  {
    path: "/userBackground",
    name: "userBackground",
    component: UserBackgroundView,
    redirect: "/userBackground/dashboard",

    children: [
      {
        path: "dashboard",
        name: "Dashboard",
        component: () =>
          import(
            "@/views/UserBackgroundViews/chart/MonthlyActivityBarChart.vue"
          ), // 主页面显示图表
      },
      {
        path: "userHome",
        name: "userHome",
        component: () =>
          import("@/views/UserBackgroundViews/components/UserHome.vue"),
        meta: {
          title: "用户后台首页",
        },
      },
      {
        path: "/userClub",
        name: "userClub",
        component: () =>
          import("@/views/UserBackgroundViews/components/UserClub.vue"),
        meta: {
          title: "用户社团",
        },
      },
      {
        path: "/userActivity",
        name: "userActivity",
        component: () =>
          import("@/views/UserBackgroundViews/components/UserActivity.vue"),
        meta: {
          title: "用户活动",
        },
      },
      {
        path: "/userApplication",
        name: "userApplication",
        component: () =>
          import("@/views/UserBackgroundViews/components/UserApplication.vue"),
        meta: {
          title: "用户申请",
        },
      },
      {
        path: "/application/user/info",
        component: () =>
          import(
            "@/views/UserBackgroundViews/components/ApplicationInfo/UserApplicationInfoView.vue"
          ),
      },
      {
        path: "/application/club/info",
        component: () =>
          import(
            "@/views/UserBackgroundViews/components/ApplicationInfo/ClubApplicationInfoView.vue"
          ),
      },
      {
        path: "/application/activity/info",
        component: () =>
          import(
            "@/views/UserBackgroundViews/components/ApplicationInfo/ActivityApplicationInfoView.vue"
          ),
      },
    ],
  },
  {
    path: "/manager",
    name: "manager-stage",
    redirect: "manager/info",
    component: () =>
      import("@/layouts/BackStageLayout/ManagerBackStageLayout.vue"),
    meta: {
      title: "社长后台",
      needRoles: [USER_ROLE_ENUM.MANAGER],
    },
    children: [
      {
        path: "info",
        name: "club-manage-info",
        component: () =>
          import(
            "@/views/ManagerBackStageViews/InfoManageViews/ClubInfoManageViews.vue"
          ),
        meta: {
          title: "社团信息",
          needRoles: [USER_ROLE_ENUM.MANAGER],
        },
      },
      {
        path: "club/update",
        name: "update-club-info",
        component: () =>
          import(
            "@/views/ManagerBackStageViews/InfoManageViews/AddCreateOrUpdateClubApplicationView.vue"
          ),
        meta: {
          title: "修改社团信息",
          hideInMenu: true,
          type: 7,
          needRoles: [USER_ROLE_ENUM.MANAGER],
        },
      },
      {
        path: "member",
        name: "club-member-manage-container",
        redirect: "member/list",
        component: () =>
          import(
            "@/views/ManagerBackStageViews/MemberManageViews/components/MemberManageContainer.vue"
          ),
        meta: {
          title: "成员管理",
          needRoles: [USER_ROLE_ENUM.MANAGER],
        },
        children: [
          {
            path: "list",
            name: "club-member-manage",
            component: () =>
              import(
                "@/views/ManagerBackStageViews/MemberManageViews/ClubMemberManageView.vue"
              ),
            meta: {
              title: "成员列表",
              needRoles: [USER_ROLE_ENUM.MANAGER],
            },
          },
          {
            path: "board",
            name: "club-member-board",
            component: () =>
              import(
                "@/views/ManagerBackStageViews/MemberManageViews/MemberBoard.vue"
              ),
            meta: {
              title: "成员统计",
              needRoles: [USER_ROLE_ENUM.MANAGER],
            },
          },
        ],
      },
      {
        path: "member/add",
        name: "add-member-to-club",
        component: () =>
          import(
            "@/views/ManagerBackStageViews/MemberManageViews/AddMemberToClubView.vue"
          ),
        meta: {
          title: "添加成员",
          hideInMenu: true,
          needRoles: [USER_ROLE_ENUM.MANAGER],
        },
      },
      {
        path: "activity",
        name: "club-activity-manage",
        component: () =>
          import(
            "@/views/ManagerBackStageViews/ActivityManageViews/ClubActivityListView.vue"
          ),
        meta: {
          title: "活动管理",
          needRoles: [USER_ROLE_ENUM.MANAGER],
        },
      },
      {
        path: "activity/info",
        name: "activity-info",
        component: () =>
          import("@/views/CommonViews/InfoViews/ActivityInfoView.vue"),
        meta: {
          hideInMenu: true,
          title: "活动详情",
          needRoles: [USER_ROLE_ENUM.MANAGER],
        },
      },
      {
        path: "activity/member",
        name: "activity-member-manage",
        component: () =>
          import(
            "@/views/ManagerBackStageViews/ActivityManageViews/ActivityMemberListView.vue"
          ),
        meta: {
          title: "活动人员管理",
          hideInMenu: true,
          needRoles: [USER_ROLE_ENUM.MANAGER],
        },
      },
      {
        path: "activity/member/add",
        name: "add-member-to-activity",
        component: () =>
          import(
            "@/views/ManagerBackStageViews/ActivityManageViews/AddMemberToActivityView.vue"
          ),
        meta: {
          title: "添加活动人员",
          hideInMenu: true,
          needRoles: [USER_ROLE_ENUM.MANAGER],
        },
      },
      {
        path: "activity/create",
        name: "add-create-activity-application",
        component: () =>
          import(
            "@/views/ManagerBackStageViews/ActivityManageViews/AddCreateOrUpdateActivityApplicationView.vue"
          ),
        meta: {
          hideInMenu: true,
          title: "申请举办活动",
          needRoles: [USER_ROLE_ENUM.MANAGER],
          type: 8,
        },
      },
      {
        path: "activity/cancel",
        name: "add-cancel-activity-application",
        component: () =>
          import(
            "@/views/ManagerBackStageViews/ActivityManageViews/AddCancelActivityApplicationView.vue"
          ),
        meta: {
          hideInMenu: true,
          title: "申请取消活动",
          needRoles: [USER_ROLE_ENUM.MANAGER],
          type: 9,
        },
      },
      {
        path: "activity/update",
        name: "add-update-activity-application",
        component: () =>
          import(
            "@/views/ManagerBackStageViews/ActivityManageViews/AddCreateOrUpdateActivityApplicationView.vue"
          ),
        meta: {
          hideInMenu: true,
          title: "申请修改活动信息",
          needRoles: [USER_ROLE_ENUM.MANAGER],
          type: 10,
        },
      },
      {
        path: "announcement",
        name: "club-announcement-manage",
        component: () =>
          import(
            "@/views/ManagerBackStageViews/AnnouncementManageViews/ClubAnnouncementListView.vue"
          ),
        meta: {
          title: "公告管理",
          needRoles: [USER_ROLE_ENUM.MANAGER],
        },
      },
      {
        path: "announcement/edit",
        name: "edit-announcement",
        component: () =>
          import(
            "@/views/ManagerBackStageViews/AnnouncementManageViews/EditAnnouncementView.vue"
          ),
        meta: {
          title: "编辑公告",
          hideInMenu: true,
          needRoles: [USER_ROLE_ENUM.MANAGER],
        },
      },
      {
        path: "announcement/info",
        name: "announcement-info",
        component: () =>
          import("@/views/CommonViews/InfoViews/ClubAnnouncementInfoView.vue"),
        meta: {
          title: "公告详情",
          hideInMenu: true,
          needRoles: [USER_ROLE_ENUM.MANAGER],
        },
      },
      {
        path: "application",
        name: "club-application-manage",
        redirect: "received",
        component: () =>
          import(
            "@/views/ManagerBackStageViews/ApplicationManageViews/components/ApplicationManageViewContainer.vue"
          ),
        meta: {
          title: "申请管理",
          needRoles: [USER_ROLE_ENUM.MANAGER],
        },
        children: [
          {
            path: "received",
            name: "club-received-applications",
            component: () =>
              import(
                "@/views/ManagerBackStageViews/ApplicationManageViews/ReceivedApplicationListView.vue"
              ),
            meta: {
              title: "我收到的",
              needRoles: [USER_ROLE_ENUM.MANAGER],
            },
          },
          {
            path: "sent",
            name: "club-sent-applications",
            component: () =>
              import(
                "@/views/ManagerBackStageViews/ApplicationManageViews/SentApplicationListView.vue"
              ),
            meta: {
              title: "我发出的",
              needRoles: [USER_ROLE_ENUM.MANAGER],
            },
          },
          {
            path: "user/info",
            name: "user-application-info",
            component: () =>
              import(
                "@/views/CommonViews/InfoViews/UserApplicationInfoView.vue"
              ),
            meta: {
              hideInMenu: true,
              title: "申请详情",
              needRoles: [USER_ROLE_ENUM.MANAGER],
            },
          },
          {
            path: "club/info",
            name: "club-application-info",
            component: () =>
              import(
                "@/views/CommonViews/InfoViews/ClubApplicationInfoView.vue"
              ),
            meta: {
              hideInMenu: true,
              title: "申请详情",
              needRoles: [USER_ROLE_ENUM.MANAGER],
            },
          },
          {
            path: "activity/info",
            name: "activity-application-info",
            component: () =>
              import(
                "@/views/CommonViews/InfoViews/ActivityApplicationInfoView.vue"
              ),
            meta: {
              hideInMenu: true,
              title: "申请详情",
              needRoles: [USER_ROLE_ENUM.MANAGER],
            },
          },
        ],
      },
    ],
  },
  {
    path: "/manage",
    name: "layout",
    component: AdminLayout,
    redirect: "/manage/club/chart",
    meta: {
      requiredRoles: [USER_ROLE_ENUM.USER],
      title: "管理员首页",
    },
    children: [
      {
        path: "club",
        redirect: "/manage/club/list",
        meta: { title: "社团管理" },
        children: [
          {
            path: "chart",
            component: () => import("@/views/admin/club/components/chart.vue"),
            meta: { title: "图表看板" },
          },
          {
            path: "list",
            component: () => import("@/views/admin/club/list/tableList.vue"),
            meta: { title: "社团列表" },
          },
          {
            path: "application",
            component: () => import("@/views/admin/club/application/tableList.vue"),
            meta: { title: "社团审核列表" },
          },
          {
            path: "details",
            component: () => import("@/views/admin/club/list/clubdetails.vue"),
            meta: { title: "社团详情" },
          },
          {
            path: "member/:clubId",
            component: () => import("@/views/admin/club/components/memberlist.vue"),
            name: "clubMember",
            meta: { title: "社团成员" },
          },
        ],
      },
      {
        path: "activity",
        redirect: "/manage/activity/list",
        meta: { title: "社团活动管理" },
        children: [
          {
            path: "list",
            component: () => import("@/views/admin/activity/list/tableList.vue"),
            meta: { title: "社团活动列表" },
          },
          {
            path: "application",
            component: () => import("@/views/admin/activity/application/tableLis.vue"),
            meta: { title: "社团活动审核列表" },
          },
          {
            path: "member/:id",
            component: () => import("@/views/admin/activity/components/activitymemeber.vue"),
            name: "activityMember",
            meta: { title: "社团活动成员列表" },
            props: true,
          },
        ],
      },
      {
        path: "notice",
        redirect: "/manage/notice/list",
        meta: { title: "公告管理" },
        children: [
          {
            path: "list",
            component: () => import("@/views/admin/notice/list/tableList.vue"),
            meta: { title: "社团公告列表" },
          },
          {
            path: "systemlist",
            component: () => import("@/views/admin/notice/list/systemlist.vue"),
            meta: { title: "系统公告列表" },
          },
        ],
      },
      {
        path: "user",
        redirect: "/manage/user/list",
        meta: { title: "用户管理" },
        children: [
          {
            path: "list",
            component: () => import("@/views/admin/user/list/tableList.vue"),
            meta: { title: "用户列表" },
          },
          {
            path: "application",
            component: () => import("@/views/admin/user/application/tableList.vue"),
            meta: { title: "用户申请列表" },
          },
        ],
      },
    ],
  },
  {
    path: "/about",
    component: () => import("@/views/adminLayout/About.vue"),
    meta: { title: "关于我们" },
  },
  {
    path: "/userCenter",
    component: () => import("@/views/adminLayout/UserCenter.vue"),
    meta: { title: "个人中心" },
  },
  {
    path: "/no-auth",
    name: "no-auth",
    component: NoAuthView,
  },
  {
    path: "/login",
    name: "login",
    component: LoginView,
  },
];
